#define _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"


void test1()
{
	SList* phead = SListInit();

	SListPushBack(phead, 1);
	SListPushBack(phead, 2);
	SListPushBack(phead, 3);
	SListPushBack(phead, 4);
	SListPrint(phead);
}


void test2()
{
	SList* phead = SListInit();

	SListPushBack(phead, 1);
	SListPushBack(phead, 2);
	SListPushBack(phead, 3);
	SListPushBack(phead, 4);
	SListPrint(phead);


	SListPushFront(phead, 10);
	SListPushFront(phead, 20);
	SListPushFront(phead, 30);
	SListPushFront(phead, 40);
	SListPrint(phead);
}



void test3()
{
	SList* phead = SListInit();

	SListPushBack(phead, 1);
	SListPushBack(phead, 2);
	SListPushBack(phead, 3);
	SListPushBack(phead, 4);
	SListPrint(phead);


	SListPushFront(phead, 10);
	SListPushFront(phead, 20);
	SListPushFront(phead, 30);
	SListPushFront(phead, 40);
	SListPrint(phead);

	SListPopBack(phead);
	SListPopBack(phead);
	SListPopBack(phead);
	SListPrint(phead);


}



void test4()
{
	SList* phead = SListInit();

	SListPushBack(phead, 1);
	SListPushBack(phead, 2);
	SListPushBack(phead, 3);
	SListPushBack(phead, 4);
	SListPrint(phead);

	SList* pos = SListFind(phead, 3);
	SListInsert(pos, 30);
	SListPrint(phead);

}


void test5()
{
	SList* phead = SListInit();

	SListPushBack(phead, 1);
	SListPushBack(phead, 2);
	SListPushBack(phead, 3);
	SListPushBack(phead, 4);
	SListPrint(phead);

	SList* pos = SListFind(phead, 3);
	SListInsert(pos, 30);
	SListPrint(phead);

	SListErase(pos);
	SListPrint(phead);

}

void test6()
{
	SList* phead = SListInit();

	SListPushBack(phead, 1);
	SListPushBack(phead, 2);
	SListPushBack(phead, 3);
	SListPushBack(phead, 4);
	SListPrint(phead);

	SListDestroy(phead);
	phead = NULL;
}


int main()
{
	//test1();
	//test2();
	//test3();
	//test4();
	//test5();
	test6();
}